module Music
	class Scale
		NOTES = %w{ c c# d d# e f f# g a a# b}
		def play
			NOTES.each {|note| yield note }
		end
	end
end
scale = Music::Scale.new
scale.play {|note| puts "Next onte is #{note}" }
# Scale不能枚举，play可以枚举，枚举器绑定到play上
enum = scale.enum_for(:play)
p enum.map {|note| note.upcase}
p enum.select {|note| note.include?('f')}
#each_slice
names = %w{ David Black Yukihiro Matsumoto}
names.each_slice(2).map do |first, last|
	p "First name: #{first}, last name: #{last}\n"
end
# with_index检索可枚举对象
p ('a'..'z').map.with_index{|letter,i| [letter,i]}

